package com.hksj.Intelligentmanagement.controller;


import com.hksj.Intelligentmanagement.common.Result;
import com.hksj.Intelligentmanagement.dto.CallDeviceWatchDTO;
import com.hksj.Intelligentmanagement.service.CallDeviceWatchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Api(tags = "手环管理")
@RestController
@RequestMapping("/api/callDeviceWatch")
public class CallDeviceWatchController {
    @Autowired
    private CallDeviceWatchService callDeviceWatchService;

    @ApiOperation("新增手环信息")
    @PostMapping("/createBracelet")
    public Result createCallDeviceWatch(@Valid @RequestBody CallDeviceWatchDTO deviceWatchDTO) {
        return callDeviceWatchService.createCallDeviceWatch(deviceWatchDTO);
    }

    @ApiOperation("删除手环信息")
    @DeleteMapping("/deleteCallDeviceWatch/{id}")
    public Result deleteCallDeviceWatch(@PathVariable("id") String id) {
        return callDeviceWatchService.deleteCallDeviceWatch(id);
    }

    @ApiOperation("修改手环信息")
    @PutMapping("/updateDeviceWatch")
    public Result updateCallDeviceWatch(@Valid @RequestBody CallDeviceWatchDTO deviceWatchDTO) {
        return callDeviceWatchService.updateCallDeviceWatch(deviceWatchDTO);
    }

    @ApiOperation("根据id查询手环信息")
    @GetMapping("/queryDeviceWatchById/{id}")
    public Result queryCallDeviceWatchById(@PathVariable("id") String id) {
        return callDeviceWatchService.queryCallDeviceWatchById(id);
    }

    @ApiOperation("动态分页模糊查询手环信息列表")
    @PostMapping("/queryBraceletListByPage")
    public Result queryCallDeviceWatchListByPage(@RequestBody CallDeviceWatchDTO deviceWatchDTO) {
        return Result.ok(callDeviceWatchService.queryCallDeviceWatchListByPage(deviceWatchDTO));
    }

}
